﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Journeo_backend.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    [AllowAnonymous]
    public class ScraperController : ControllerBase
    {
        private readonly IScraperService _scraperService;

        public ScraperController(IScraperService scraperService)
        {
            _scraperService = scraperService;
        }

        [HttpPost("scrape")]
        public async Task<IActionResult> ScrapeData()
        {
            await _scraperService.ScrapeAllDataAsync();
            return Ok("数据抓取完成");
        }
    }
}
